import XrFrame from 'XrFrame';
const xrFrameSystem = wx.getXrFrameSystem();

xrFrameSystem.registerGeometry('star', scene => {
  const vl = scene.createVertexLayout({
    attributes: [
      {
        name: "a_position",
        format: xrFrameSystem.EVertexFormat.FLOAT3,
        offset: 0,
        usage: xrFrameSystem.EVertexLayoutUsage.POSITION
      },
      {
        name: "a_normal",
        format: xrFrameSystem.EVertexFormat.FLOAT3,
        offset: 12,
        usage: xrFrameSystem.EVertexLayoutUsage.NORMAL
      }
    ],
    stride: 24
  });

  const vb = new Float32Array([0.0010823551565408707,3.630120509745538e-12,0.0013188635930418968,0.27796244621276855,0.8805698752403259,0.3838407099246979,0.00009323284029960632,2.8082874567458838e-12,0.0020351484417915344,0.27796244621276855,0.8805698752403259,0.3838407099246979,0.24488118290901184,-0.1113351583480835,0.08018352836370468,0.27796244621276855,0.8805698752403259,0.3838407099246979,0.6436620354652405,-0.1113351583480835,-0.20859801769256592,0.27796244621276855,0.8805698752403259,0.3838407099246979,-0.0005219941376708448,2.297113887994584e-12,0.002493109554052353,0.27153608202934265,0.8849542140960693,0.3783177137374878,-0.0015015341341495514,1.4832429989092288e-12,0.0031961705535650253,0.27153608202934265,0.8849542140960693,0.3783177137374878,-0.3980743885040283,-0.1113351583480835,0.5482680201530457,0.27153608202934265,0.8849542140960693,0.3783177137374878,-0.0031573032028973103,-0.1113351583480835,0.26481786370277405,0.27153608202934265,0.8849542140960693,0.3783177137374878,-0.0021115075796842575,9.764139366832958e-13,0.0013188640587031841,0.002885879948735237,0.8797516226768494,-0.47542497515678406,-0.000895695760846138,1.9866035899651635e-12,0.0013262443244457245,0.002885879948735237,0.8797516226768494,-0.47542497515678406,-0.1538211703300476,-0.1113351583480835,-0.20562252402305603,0.002885879948735237,0.8797516226768494,-0.47542497515678406,-0.6439951062202454,-0.1113351583480835,-0.20859791338443756,0.002885879948735237,0.8797516226768494,-0.47542497515678406,-0.00013963831588625908,2.6147942318310857e-12,0.001320062205195427,-0.0004604102286975831,0.8828508257865906,-0.4696534276008606,0.0010823551565408707,3.630120509745538e-12,0.0013188635930418968,-0.0004604102286975831,0.8828508257865906,-0.4696534276008606,0.6436620354652405,-0.1113351583480835,-0.20859801769256592,-0.0004604102286975831,0.8828508257865906,-0.4696534276008606,0.15099558234214783,-0.1113351583480835,-0.20811505615711212,-0.0004604102286975831,0.8828508257865906,-0.4696534276008606,0.00047238264232873917,3.1233242988454313e-12,0.003196168690919876,-0.2647762894630432,0.8886240720748901,0.3744874894618988,-0.0005219941376708448,2.297113887994584e-12,0.002493109554052353,-0.2647762894630432,0.8886240720748901,0.3744874894618988,-0.0031573032028973103,-0.1113351583480835,0.26481786370277405,-0.2647762894630432,0.8886240720748901,0.3744874894618988,0.39774152636528015,-0.1113351583480835,0.5482679009437561,-0.2647762894630432,0.8886240720748901,0.3744874894618988,-0.0011174380779266357,1.8023693431831744e-12,0.002045039553195238,-0.27720320224761963,0.8827025294303894,0.3794664740562439,-0.0021115075796842575,9.764139366832958e-13,0.0013188640587031841,-0.27720320224761963,0.8827025294303894,0.3794664740562439,-0.6439951062202454,-0.1113351583480835,-0.20859791338443756,-0.27720320224761963,0.8827025294303894,0.3794664740562439,-0.24322021007537842,-0.1113351583480835,0.08417129516601562,-0.27720320224761963,0.8827025294303894,0.3794664740562439,-0.0005145758623257279,2.303252640695197e-12,0.00015862658619880676,0.4488120377063751,0.8818025588989258,-0.1448865383863449,-0.00013963831588625908,2.6147942318310857e-12,0.001320062205195427,0.4488120377063751,0.8818025588989258,-0.1448865383863449,0.15099558234214783,-0.1113351583480835,-0.20811505615711212,0.4488120377063751,0.8818025588989258,-0.1448865383863449,-0.00016650545876473188,-0.1113351583480835,-0.6763667464256287,0.4488120377063751,0.8818025588989258,-0.1448865383863449,0.00009323284029960632,2.8082874567458838e-12,0.0020351484417915344,0.447871595621109,0.8820540308952332,-0.14625956118106842,0.00047238264232873917,3.1233242988454313e-12,0.003196168690919876,0.447871595621109,0.8820540308952332,-0.14625956118106842,0.39774152636528015,-0.1113351583480835,0.5482679009437561,0.447871595621109,0.8820540308952332,-0.14625956118106842,0.24488118290901184,-0.1113351583480835,0.08018352836370468,0.447871595621109,0.8820540308952332,-0.14625956118106842,-0.0015015341341495514,1.4832429989092288e-12,0.0031961705535650253,-0.4550110101699829,0.8774480223655701,-0.1518225520849228,-0.0011174380779266357,1.8023693431831744e-12,0.002045039553195238,-0.4550110101699829,0.8774480223655701,-0.1518225520849228,-0.24322021007537842,-0.1113351583480835,0.08417129516601562,-0.4550110101699829,0.8774480223655701,-0.1518225520849228,-0.3980743885040283,-0.1113351583480835,0.5482680201530457,-0.4550110101699829,0.8774480223655701,-0.1518225520849228,-0.000895695760846138,1.9866035899651635e-12,0.0013262443244457245,-0.4459637701511383,0.8831347227096558,-0.14556612074375153,-0.0005145758623257279,2.303252640695197e-12,0.00015862658619880676,-0.4459637701511383,0.8831347227096558,-0.14556612074375153,-0.00016650545876473188,-0.1113351583480835,-0.6763667464256287,-0.4459637701511383,0.8831347227096558,-0.14556612074375153,-0.1538211703300476,-0.1113351583480835,-0.20562252402305603,-0.4459637701511383,0.8831347227096558,-0.14556612074375153,-0.000895695760846138,1.9866035899651635e-12,0.0013262443244457245,-8.308768117970544e-10,1,-9.243900946347833e-15,-0.0021115075796842575,9.764139366832958e-13,0.0013188640587031841,-8.308768117970544e-10,1,-9.243900946347833e-15,-0.0011174380779266357,1.8023693431831744e-12,0.002045039553195238,-8.308768117970544e-10,1,-9.243900946347833e-15,-0.0015015341341495514,1.4832429989092288e-12,0.0031961705535650253,-8.308768117970544e-10,1,-9.243900946347833e-15,-0.0005219941376708448,2.297113887994584e-12,0.002493109554052353,-8.308768117970544e-10,1,-9.243900946347833e-15,0.00047238264232873917,3.1233242988454313e-12,0.003196168690919876,-8.308768117970544e-10,1,-9.243900946347833e-15,0.00009323284029960632,2.8082874567458838e-12,0.0020351484417915344,-8.308768117970544e-10,1,-9.243900946347833e-15,0.0010823551565408707,3.630120509745538e-12,0.0013188635930418968,-8.308768117970544e-10,1,-9.243900946347833e-15,-0.00013963831588625908,2.6147942318310857e-12,0.001320062205195427,-8.308768117970544e-10,1,-9.243900946347833e-15,-0.0005145758623257279,2.303252640695197e-12,0.00015862658619880676,-8.308768117970544e-10,1,-9.243900946347833e-15,0.0011354610323905945,4.1467661304750436e-8,0.0013015158474445343,0.27798038721084595,0.8805534839630127,0.38386544585227966,0.00011346209794282913,4.1467661304750436e-8,0.0020416071638464928,0.27798038721084595,0.8805534839630127,0.38386544585227966,0.24488118290901184,-0.1113351583480835,0.08018352836370468,0.27798038721084595,0.8805534839630127,0.38386544585227966,0.6436620354652405,-0.1113351583480835,-0.20859801769256592,0.27798038721084595,0.8805534839630127,0.38386544585227966,-0.0005222122417762876,4.1467661304750436e-8,0.002514788880944252,0.27155372500419617,0.8849382996559143,0.3783423602581024,-0.0015343083068728447,4.1467661304750436e-8,0.003241216763854027,0.27155372500419617,0.8849382996559143,0.3783423602581024,-0.3980743885040283,-0.1113351583480835,0.5482680201530457,0.27155372500419617,0.8849382996559143,0.3783423602581024,-0.0031573032028973103,-0.1113351583480835,0.26481786370277405,0.27155372500419617,0.8849382996559143,0.3783423602581024,-0.002164555713534355,4.1467661304750436e-8,0.0013015158474445343,0.0028860531747341156,0.8797350525856018,-0.47545552253723145,-0.0009083347395062447,4.1467661304750436e-8,0.0013091415166854858,0.0028860531747341156,0.8797350525856018,-0.47545552253723145,-0.1538211703300476,-0.1113351583480835,-0.20562252402305603,0.0028860531747341156,0.8797350525856018,-0.47545552253723145,-0.6439951062202454,-0.1113351583480835,-0.20859791338443756,0.0028860531747341156,0.8797350525856018,-0.47545552253723145,-0.0001271483488380909,4.1467661304750436e-8,0.0013027535751461983,-0.0004604338319040835,0.8828346729278564,-0.46968385577201843,0.0011354610323905945,4.1467661304750436e-8,0.0013015158474445343,-0.0004604338319040835,0.8828346729278564,-0.46968385577201843,0.6436620354652405,-0.1113351583480835,-0.20859801769256592,-0.0004604338319040835,0.8828346729278564,-0.46968385577201843,0.15099558234214783,-0.1113351583480835,-0.20811505615711212,-0.0004604338319040835,0.8828346729278564,-0.46968385577201843,0.000505213625729084,4.1467661304750436e-8,0.003241216763854027,-0.26479363441467285,0.8886085748672485,0.3745120167732239,-0.0005222122417762876,4.1467661304750436e-8,0.002514788880944252,-0.26479363441467285,0.8886085748672485,0.3745120167732239,-0.0031573032028973103,-0.1113351583480835,0.26481786370277405,-0.26479363441467285,0.8886085748672485,0.3745120167732239,0.39774152636528015,-0.1113351583480835,0.5482679009437561,-0.26479363441467285,0.8886085748672485,0.3745120167732239,-0.0011374466121196747,4.1467661304750436e-8,0.0020518270321190357,-0.277221143245697,0.8826862573623657,0.3794909715652466,-0.002164555713534355,4.1467661304750436e-8,0.0013015158474445343,-0.277221143245697,0.8826862573623657,0.3794909715652466,-0.6439951062202454,-0.1113351583480835,-0.20859791338443756,-0.277221143245697,0.8826862573623657,0.3794909715652466,-0.24322021007537842,-0.1113351583480835,0.08417129516601562,-0.277221143245697,0.8826862573623657,0.3794909715652466,-0.0005145473987795413,4.1467661304750436e-8,0.00010271556675434113,0.44884100556373596,0.8817862868309021,-0.14489588141441345,-0.0001271483488380909,4.1467661304750436e-8,0.0013027535751461983,0.44884100556373596,0.8817862868309021,-0.14489588141441345,0.15099558234214783,-0.1113351583480835,-0.20811505615711212,0.44884100556373596,0.8817862868309021,-0.14489588141441345,-0.00016650545876473188,-0.1113351583480835,-0.6763667464256287,0.44884100556373596,0.8817862868309021,-0.14489588141441345,0.00011346209794282913,4.1467661304750436e-8,0.0020416071638464928,0.4479005038738251,0.8820376992225647,-0.14626897871494293,0.000505213625729084,4.1467661304750436e-8,0.003241216763854027,0.4479005038738251,0.8820376992225647,-0.14626897871494293,0.39774152636528015,-0.1113351583480835,0.5482679009437561,0.4479005038738251,0.8820376992225647,-0.14626897871494293,0.24488118290901184,-0.1113351583480835,0.08018352836370468,0.4479005038738251,0.8820376992225647,-0.14626897871494293,-0.0015343083068728447,4.1467661304750436e-8,0.003241216763854027,-0.4550401568412781,0.8774312734603882,-0.15183229744434357,-0.0011374466121196747,4.1467661304750436e-8,0.0020518270321190357,-0.4550401568412781,0.8774312734603882,-0.15183229744434357,-0.24322021007537842,-0.1113351583480835,0.08417129516601562,-0.4550401568412781,0.8774312734603882,-0.15183229744434357,-0.3980743885040283,-0.1113351583480835,0.5482680201530457,-0.4550401568412781,0.8774312734603882,-0.15183229744434357,-0.0009083347395062447,4.1467661304750436e-8,0.0013091415166854858,-0.4459926187992096,0.8831185698509216,-0.14557553827762604,-0.0005145473987795413,4.1467661304750436e-8,0.00010271556675434113,-0.4459926187992096,0.8831185698509216,-0.14557553827762604,-0.00016650545876473188,-0.1113351583480835,-0.6763667464256287,-0.4459926187992096,0.8831185698509216,-0.14557553827762604,-0.1538211703300476,-0.1113351583480835,-0.20562252402305603,-0.4459926187992096,0.8831185698509216,-0.14557553827762604,-0.0009083347395062447,4.1467661304750436e-8,0.0013091415166854858,3.0784483035645183e-12,1,0,-0.002164555713534355,4.1467661304750436e-8,0.0013015158474445343,3.0784483035645183e-12,1,0,-0.0011374466121196747,4.1467661304750436e-8,0.0020518270321190357,3.0784483035645183e-12,1,0,-0.0015343083068728447,4.1467661304750436e-8,0.003241216763854027,3.0784483035645183e-12,1,0,-0.0005222122417762876,4.1467661304750436e-8,0.002514788880944252,3.0784483035645183e-12,1,0,0.000505213625729084,4.1467661304750436e-8,0.003241216763854027,3.0784483035645183e-12,1,0,0.00011346209794282913,4.1467661304750436e-8,0.0020416071638464928,3.0784483035645183e-12,1,0,0.0011354610323905945,4.1467661304750436e-8,0.0013015158474445343,3.0784483035645183e-12,1,0,-0.0001271483488380909,4.1467661304750436e-8,0.0013027535751461983,3.0784483035645183e-12,1,0,-0.0005145473987795413,4.1467661304750436e-8,0.00010271556675434113,3.0784483035645183e-12,1,0]);
  const ib = new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23,24,25,26,24,26,27,28,29,30,28,30,31,32,33,34,32,34,35,36,37,38,36,38,39,40,48,49,43,44,42,42,40,41,40,42,46,46,42,45,45,42,44,48,46,47,46,48,40,50,51,52,50,52,53,54,55,56,54,56,57,58,59,60,58,60,61,62,63,64,62,64,65,66,67,68,66,68,69,70,71,72,70,72,73,74,75,76,74,76,77,78,79,80,78,80,81,82,83,84,82,84,85,86,87,88,86,88,89,90,98,99,93,94,92,92,90,91,90,92,96,96,92,95,95,92,94,98,96,97,96,98,90]);

  const geo = scene.createGeometry(vl, vb, ib);

  geo.setBoundBall(new xrFrameSystem.Vector3(), 1);
  geo.addSubMesh(ib.length, 0, 0);

  return geo;
});
